package com.example.riskmanage.service.impl;

import com.example.riskmanage.bean.User;
import com.example.riskmanage.dao.UserDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.example.riskmanage.service.UserManager;


@Service
public class UserManagerImpl implements UserManager {

    @Autowired
    UserDao userDao;

    @Override
    public User loginService(User user) {
        return userDao.findAllByUserId(user.getUserId());

    }

    @Override
    public String findByUserId(User user) {
        String flag = "";
        User use = userDao.findByUserId(user.getUserId());
        if (use != null) {
            flag = "error";
        } else {
            userDao.save(user);
            flag = "ok";
        }

        return flag;
    }


}
